import request from './request';
var ua = navigator.userAgent;
var isiOS = ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端

function getDownUrl() {
  return new Promise((rej, res) => {
    request
      .post({
        url: `/wallet-cms/content/getLastVersionInfo`,
        data: {
          systemType: !isiOS ? 1 : 2,
        },
      })
      .then(res => {
        if (res && res.data.match(/(http|https):\/\/([\w.]+\/?)\S*/)) {
          rej({
            down: res.data,
          });
        }
      });
  });
}
export { getDownUrl };
